﻿@{
    ViewBag.Title = "Easy-UI测试";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section scripts{
<script src="~/Areas/Sys/ViewModels/Menu.js"></script>
<script type="text/javascript">
    var formatsys_log = function (value) {
        var html = '<a href="#" onclick=\'view("' + value + '")\'><span class="icon icon-search">&nbsp;</span>[查看]</a>';
        html += '<a href="/sys/log/download/' + value + '" style="margin-left:10px"><span class="icon icon-download">&nbsp;</span>[下载]</a>';
        return html;
    };

    var viewModel = function () {
        var self = this;
        this.form = { LogDate: ko.observable() };
        this.login = {
            size: { w: 16, h: 123 },
            url: "/api/sys/log/getloginlog",
            queryParams: ko.observable(),
            pagination: true
        };
        this.operate = {
            size: { w: 16, h: 123 },
            url: "/api/sys/log/getoperatelog",
            queryParams: ko.observable(),
            pagination: true
        };
        this.system = {
            size: { w: 16, h: 123 },
            url: "/api/sys/log/getsystemlog",
            queryParams: ko.observable(),
            pagination: true
        };

        this.refreshClick = function () {
            window.location.reload();
        };

        this.searchClick = function () {
            this.login.queryParams(ko.toJS(this.form));
            this.operate.queryParams(ko.toJS(this.form));
            this.system.queryParams(ko.toJS(this.form));
        };

        this.clearClick = function () {
            this.form.LogDate("");
            this.searchClick();
        }
    };

    var view = function (id) {
        com.dialog({
            title: "查看日志",
            width: 700,
            height: 500,
            maximizable: true,
            html: '<iframe id="_view_sys_log_" scrolling="auto" frameborder="0"  style="width:100%;height:100%;"></iframe>',
            viewModel: function (w) {
                w.find("iframe").attr("src", "/sys/log/view/" + id);
            }
        });
    };

    ko.bindingViewModel(new viewModel());
</script>

    }

<div id="tt" class="easyui-tabs">
    <div title="登陆日志">
        <table data-bind="datagrid:login">
            <thead>
                <tr>
                    <th field="UserCode" align="left" width="70">登陆帐号   </th>
                    <th field="UserName" align="left" width="100">用户名称   </th>
                    <th field="HostIP" align="left" width="200">登陆IP     </th>
                    <th field="HostName" align="left" width="100">登陆机器名   </th>
                    <th field="LoginCity" align="left" width="150">登陆位置   </th>
                    <th field="LoginDate" align="center" width="130" formatter="com.formatTime">登陆日期   </th>
                </tr>
            </thead>
        </table>
    </div>

    <div title="操作日志">
        <table data-bind="datagrid:operate">
            <thead>
                <tr>
                    <th field="UserCode" align="left" width="70">操作帐号   </th>
                    <th field="UserName" align="left" width="100">操作人   </th>
                    <th field="Position" align="left" width="150">位置     </th>
                    <th field="Target" align="left" width="100">对象   </th>
                    <th field="Type" align="left" width="100">类型   </th>
                    <th field="Message" align="left" width="150">数据   </th>
                    <th field="Date" align="center" width="120" formatter="com.formatTime">日期   </th>
                </tr>
            </thead>
        </table>
    </div>
    <div title="系统日志">
        <table data-bind="datagrid:system">
            <thead>
                <tr>
                    <th field="filename" align="left" width="150">日志文件   </th>
                    <th field="size" align="left" width="100">文件大小   </th>
                    <th field="id" align="center" width="150" formatter="formatsys_log">操作     </th>
                </tr>
            </thead>
        </table>
    </div>
</div> 


@*<body class="easyui-layout" data-options="fit:true,scroll:'no'">
    <h2>Tab 选项卡</h2>
    <div style="margin:20px 0 10px 0;"></div>
    <div class="easyui-tabs" style="width:700px;height:250px">
        <div title="选项1" style="padding:10px">
            <ul>
                <li>123</li>
                <li>456</li>
                <li>789</li>
                
            </ul>
        </div>
        <div title="选项2" style="padding:10px">
            <ul class="easyui-tree" data-options="url:'/api/sys/log/getoperatelog',method:'get',animate:true">
                <li>123</li>
                <li>456</li>
                <li>789</li>
            </ul>
        </div>
        <div title="选项3" data-options="iconCls:'icon-help',closable:true" style="padding:10px">
            <li>123</li>
            <li>456</li>
            <li>789</li>
        </div>
    </div>
    @*<div data-options="region:'north',border:false" style="height: 74px; background: #2596ea; padding: 10px">
        EasyUIDemo
    </div>
    <div data-options="region:'west',split:true,title:'导航菜单'" style="width: 170px;">
        <div class="easyui-accordion" data-options="fit:true,border:false">
            <div title="系统设置1" data-options="selected:true">
                <div style="margin: 5px">
                    <ul class="tree easyui-tree" data-options="animate:true,lines:true">
                        <li data-options="iconCls:'icon-group'">
                            <span>基本设置</span>
                            <ul>
                                <li data-options="iconCls:'icon-group_add'">
                                    <span>test1</span>
                                </li>
                                <li data-options="iconCls:'icon-group_delete'">
                                    <span>test2</span>
                                </li>
                                <li data-options="iconCls:'icon-group_edit'">
                                    <span>test3</span>
                                </li>
                            </ul>
                        </li>
                        <li data-options="state:'closed',iconCls:'icon-joystick'">
                            <span>系统设置</span>
                            <ul>
                                <li data-options="iconCls:'icon-joystick_add'">
                                    <span>test4</span>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
            <div title="系统设置2" style="padding: 10px;">
                content2
            </div>
            <div title="系统设置3" style="padding: 10px">
                content3
            </div>
        </div>
    </div>
    <div data-options="region:'south',border:false" style="height: 23px;">
        <div class="footer">EasyUIDemo</div>
    </div>
    <div data-options="region:'center'">
        <div id="tabs" class="easyui-tabs" data-options="tools:'#tab-tools',fit:true,border:false">
            <div title="主页" data-options="iconCls:'icon-house'" style="padding: 10px;">
                
            </div>
        </div>
        <div id="tab-tools">
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-add'" onclick="addTab()"></a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-remove'" onclick="removeTab()"></a>
        </div>
    </div>

    <div id="mm" class="easyui-menu" style="width: 150px;">
        <div id="refresh" data-options="iconCls:'icon-arrow_refresh'">刷新</div>
        <div class="menu-sep"></div>
        <div id="close">关闭</div>
        <div id="closeall">全部关闭</div>
        <div id="closeother">除此之外全部关闭</div>
        <div class="menu-sep"></div>
        <div id="closeright">当前页右侧全部关闭</div>
        <div id="closeleft">当前页左侧全部关闭</div>
        <div class="menu-sep"></div>
        <div id="exit">退出</div>
    </div>
    <script>
        $(function () {
            $('#dlg').dialog('close')
        })
        function submitForm() {
            $('#dlg').dialog('open')
            //$('#ff').form('submit');
        }
        function clearForm() {
            $('#ff').form('clear');
        }
    </script>*@

